package singleton;

/**
 * 饿汉式（静态代码块）
 * 优点：写法简单，线程安全，效率高。
 * 缺点：非懒加载。
 * Created by thiswhyme on 2019/03/15.
 */
public class HungryScSingleton {

    private static HungryScSingleton instance;

    static {
        instance = new HungryScSingleton();
    }

    private HungryScSingleton() {

    }

    public static HungryScSingleton getInstance () {
        return instance;
    }
}
